From a7c8d79dcf9c2fa53d2feda2d306a15c0d25cdea Mon Sep 17 00:00:00 2001 From: "john.levon@sun.com" Date: Tue, 7 Feb 2006 20:46:13 +0000 Subject: [PATCH] Fix pygrub to handle timeout of -1 (wait forever). Only call use_default_colors() if it's available. Signed-off-by: John Levon --- tools/pygrub/src/pygrub | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub index 5923b133b1..e0a5d31fdc 100644 --- a/tools/pygrub/src/pygrub +++ b/tools/pygrub/src/pygrub @@ -29,7 +29,8 @@ PYGRUB_VER = 0.3 def draw_window(): stdscr = curses.initscr() - curses.use_default_colors() + if hasattr(curses, 'use_default_colors'): + curses.use_default_colors() try: curses.curs_set(0) except _curses.error: @@ -152,15 +153,16 @@ def get_entry_idx(cf, entry): def main(cf = None): mytime = 0 + timeout = int(cf.timeout) (stdscr, win) = draw_window() stdscr.timeout(1000) selected = cf.default - while (mytime < int(cf.timeout)): - if cf.timeout != -1 and mytime != -1: + while (timeout == -1 or mytime < int(timeout)): + if timeout != -1 and mytime != -1: stdscr.addstr(20, 5, "Will boot selected entry in %2d seconds" - %(int(cf.timeout) - mytime)) + %(int(timeout) - mytime)) else: stdscr.addstr(20, 5, " " * 80) -- 2.30.2